package iad.parser;

import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.text.AttributedCharacterIterator.Attribute;
import java.util.ArrayList;
import java.util.List;

public class AdultParser {

	public static void parser(File f){

		try
		{
			FileInputStream fstream = new FileInputStream(f.getName());
			// Get the object of DataInputStream
			DataInputStream in = new DataInputStream(fstream);
			BufferedReader br = new BufferedReader(new InputStreamReader(in));
			String strLine;

			String[] tab;


			List<Attribute> firstAttributeList = new ArrayList<Attribute>();
			List<Attribute> secondAttributeList = new ArrayList<Attribute>();
			List<Attribute> thirdAttributeList = new ArrayList<Attribute>();
			List<Attribute> fourthAttributeList = new ArrayList<Attribute>();
			List<Attribute> fifthAttributeList = new ArrayList<Attribute>();
			List<Attribute> sixthAttributeList = new ArrayList<Attribute>();
			List<Attribute> seventhAttributeList = new ArrayList<Attribute>();
			List<Attribute> eighthAttributeList = new ArrayList<Attribute>();
			List<Attribute> ninethAttributeList = new ArrayList<Attribute>();
			List<Attribute> tenthAttributeList = new ArrayList<Attribute>();
			List<Attribute> eleventhAttributeList = new ArrayList<Attribute>();
			List<Attribute> twelvethAttributeList = new ArrayList<Attribute>();
			List<Attribute> thirteenthAttributeList = new ArrayList<Attribute>();
			List<Attribute> fourteenthAttributeList = new ArrayList<Attribute>();
			List<Attribute> fifteenthAttributeList = new ArrayList<Attribute>();

			//Read File Line By Line
			while ((strLine = br.readLine()) != null){

//				Attribute firstAttribute = new Attribute();
//				Attribute secondAttribute = new Attribute();
//				Attribute thirdAttribute = new Attribute();
//				Attribute fourthAttribute = new Attribute();
//				Attribute fifthAttribute = new Attribute();
//				Attribute sixthAttribute = new Attribute();
//				Attribute seventhAttribute = new Attribute();
//				Attribute eighthAttribute = new Attribute();
//				Attribute ninethAttribute = new Attribute();
//				Attribute tenthAttribute = new Attribute();
//				Attribute eleventhAttribute = new Attribute();
//				Attribute twelvethAttribute = new Attribute();
//				Attribute thirteenthAttribute = new Attribute();
//				Attribute fourteenthAttribute = new Attribute();
//				Attribute fifteenthAttribute = new Attribute();

				// Print the content on the console
				//System.out.println (strLine);
				tab=strLine.split(",");

				//tu musze z tablicy przepisac przeparsowac do odpowiedniego atrybutu


//				firstAttribute.set Integer.parseInt(tab[0]);   
//				secondAttribute.set tab[1];
//				thirdAttribute.set Double.parseDouble(tab[2]);
//				fourthAttribute.set tab[3];
//				fifthAttribute.set Integer.parseInt(tab[4]);
//				sixthAttribute.set tab[5];
//				seventhAttribute.set tab[6];
//				eightthAttribute.set tab[7];
//				ninethAttributeList.set tab[8]; 
//				tenthAttribute.set tab[9];
//				eleventhAttribute.set Integer.parseInt(tab[10]);
//				twelvethAttribute.set Integer.parseInt(tab[11]);
//				thirteenthAttribute.set Integer.parseInt(tab[12]);
//				fourteenthAttribute.set tab[13];
//				fifteenthAttribute.set tab[14]; //zbadac czy tu int czy string

//				firstAttributeList.add(firstAttribute);
//				secondAttributeList.add(secondAttribute);
//				thirdAttributeList.add(thirdAttribute);
//				fourthAttributeList.add(fourthAttribute);
//				fifthAttributeList.add(fifthAttribute);
//				sixthAttributecList.add(sixthAttribute);
//				seventhAttributeList.add(seventhAttribute);
//				eighthAttributeList.add(eighthAttribute);
//				ninethAttributeList.add(ninethAttribute);
//				tenthAttributeList.add(tenthAttribute);
//				eleventhAttributeList.add(eleventhAttribute);
//				twelvethAttributeList.add(twelvethAttribute);
//				thirteenthAttributeList.add(thirteenthAttribute);
//				fourteenthAttributeList.add(fourteenthAttribute);
//				fifteenthAttributeList.add(fifteenthAttribute);

			}
			//Close the input stream
			in.close();
		}
		catch (Exception e){//Catch exception if any
			System.err.println("Error: " + e.getMessage());
		}

	}
}
